Class GameResult

java.lang.Object
ddejonge.bandana.tournamentObserver.GameResult
All Implemented Interfaces:
java.io.Serializable

public class GameResult
extends java.lang.Object
implements java.io.Serializable
See Also:
Serialized Form
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  GameResult.PlayerResult
    Represents a player's outcome of a game.
  • Constructor Summary

    Constructors 
    Constructor Description
    GameResult​(java.lang.String[] smrMessage, java.util.Map<java.lang.String,​java.lang.Integer> power2numDeadlinesMissed)  
  • Method Summary

    Modifier and Type Method Description
    boolean containsName​(java.lang.String name)  
    boolean endedInSolo()
    Returns true if this game ended in a solo victory.
    java.util.ArrayList<java.lang.String> getNames()
    Returns a list with the names of all the players that participated in this game.
    int getNumMissedDeadlines​(java.lang.String agentNameOrPowerName)  
    int getNumSupplyCenters​(java.lang.String agentNameOrPowerName)
    Returns the number of supply centers at the end of the game of the player or power with the given name.
    int getNumSurvivors()
    Returns the number of players that did not get eliminated.
    java.lang.String getPlayerNameByPower​(java.lang.String powerName)
    Returns the name of the player that played the given power.
    java.lang.String getPowerPlayed​(java.lang.String playerName)
    Returns the power played by the player with the given name.
    double getRank​(java.lang.String playerNameOrPowerName)
    Returns the rank in this game of the player with the given name.
    java.lang.String getSoloWinner()
    Returns the name of the player that obtained a Solo Victory, or returns null if the game ended in a draw.
    int getYearOfElimination​(java.lang.String playerNameOrPowerName)
    If the player with the given name got eliminated this method returns the year in which it was eliminated.
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • GameResult

      public GameResult​(java.lang.String[] smrMessage, java.util.Map<java.lang.String,​java.lang.Integer> power2numDeadlinesMissed)
      Parameters:
      smrMessage - Message received from the game server containing all the info about the outcome of the game.
      power2numDeadlinesMissed - Maps each power name to the number of times that that power missed a deadline in this game.
  • Method Details

    • containsName

      public boolean containsName​(java.lang.String name)
    • getNames

      public java.util.ArrayList<java.lang.String> getNames()
      Returns a list with the names of all the players that participated in this game.
      Returns:
    • endedInSolo

      public boolean endedInSolo()
      Returns true if this game ended in a solo victory.
      Returns:
    • getNumSurvivors

      public int getNumSurvivors()
      Returns the number of players that did not get eliminated. That is: the number of players that ended the game with at least 1 unit.
    • getRank

      public double getRank​(java.lang.String playerNameOrPowerName)
      Returns the rank in this game of the player with the given name. e.g. if a player with name DumbBot_1 finished in 5th place then calling getRank("DumbBot_1") will return 5. If DumbBot_1 and another player together finished in a shared 5th place, then calling getRank("DumbBot_1") will return 5.5.
      Parameters:
      playerNameOrPowerName -
      Returns:
    • getNumSupplyCenters

      public int getNumSupplyCenters​(java.lang.String agentNameOrPowerName)
      Returns the number of supply centers at the end of the game of the player or power with the given name.
      Parameters:
      agentNameOrPowerName -
      Returns:
    • getYearOfElimination

      public int getYearOfElimination​(java.lang.String playerNameOrPowerName)
      If the player with the given name got eliminated this method returns the year in which it was eliminated. If the player was not eliminated it returns 0.
      Parameters:
      playerNameOrPowerName -
      Returns:
    • getNumMissedDeadlines

      public int getNumMissedDeadlines​(java.lang.String agentNameOrPowerName)
    • getPowerPlayed

      public java.lang.String getPowerPlayed​(java.lang.String playerName)
      Returns the power played by the player with the given name.
      Parameters:
      playerName -
      Returns:
    • getPlayerNameByPower

      public java.lang.String getPlayerNameByPower​(java.lang.String powerName)
      Returns the name of the player that played the given power.
      Parameters:
      powerName - must be one of the following: "AUS", "ENG", "FRA", "GER", "ITA", "RUS" or "TUR".
      Returns:
    • getSoloWinner

      public java.lang.String getSoloWinner()
      Returns the name of the player that obtained a Solo Victory, or returns null if the game ended in a draw.
      Returns:
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object